﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package reprise.controls {
    import flash.events.*;

    public class LabelButton extends AbstractButton {

        protected var m_labelDisplay:Label;
        protected var m_label:String;// = ""

        public function LabelButton(_arg1:String=null){
            m_label = ((_arg1) || (""));
        }
        public function setLabel(_arg1:String):void{
            m_label = _arg1;
            if (!m_labelDisplay){
                return;
            };
            m_labelDisplay.setLabel(_arg1);
            invalidate();
        }
        override protected function buttonDisplay_click(_arg1:MouseEvent):void{
            if (_arg1.target != this){
                _arg1.stopImmediatePropagation();
                dispatchEvent(new MouseEvent(MouseEvent.CLICK, true, false, mouseX, mouseY));
                return;
            };
            super.buttonDisplay_click(_arg1);
        }
        override protected function calculateContentWidth():int{
            if (m_currentStyles.display == "inline"){
                return (m_labelDisplay.width);
            };
            return (super.calculateContentWidth());
        }
        override protected function createChildren():void{
            m_labelDisplay = Label(addComponent("label", null, Label));
            m_labelDisplay.label = m_label;
        }
        public function getLabel():String{
            var _local1:String = m_labelDisplay.getLabel();
            return (_local1.substring((_local1.indexOf(">") + 1), _local1.lastIndexOf("<")));
        }
        override protected function applyStyles():void{
            super.applyStyles();
            if (m_changedStyleProperties["selectable"]){
                m_labelDisplay.setStyle("selectable", String(m_currentStyles.selectable));
            };
            if (m_changedStyleProperties["cursor"]){
                m_labelDisplay.setStyle("cursor", m_currentStyles.cursor);
            };
            if (m_changedStyleProperties["textDecoration"]){
                m_labelDisplay.setStyle("textDecoration", m_currentStyles.textDecoration);
            };
        }

    }
}//package reprise.controls 
